#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QAudioInput>

namespace Ui {
    class MainWindow;
}

class QTimer;
class QActionGroup;
class AudioControl;
class QCloseEvent;

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);

    void setAudioLevel(qreal value);

    ~MainWindow();

protected:
    void closeEvent(QCloseEvent *event);
private slots:
    void stop();
    void start();
    void pause();
    void reset();
    void resetAll();
    void increase();
    void loadSettings(const QString &profile = "Default");
    void loadProfile();
    void about();
    void helpContent();
    void generateProfiles();
    void manageProfiles();
    void loadNextProfile();
    void status();
    void deviceChanged(int index);
    void stateChanged(QAudio::State state);
    void notified();
    void audioControl();
    void toggleAudio(bool toggle);
    
private:
    void initializeAudio();
    void createAudioInput();
    void loadAudioDevices();
    void saveSettings();


    Ui::MainWindow *ui;
    QTimer* n_timer;
    QTimer* p_timer;
    QTimer* a_timer;
    QActionGroup* profiles;
    bool paused;
    bool stoped;
    //audio
    QAudioDeviceInfo m_device;
    AudioControl *m_audioControl;
    QAudioFormat m_format;
    QAudioInput *m_audioInput;
    QIODevice *m_input;
    bool m_pullMode;
    QByteArray m_buffer;
};

#endif // MAINWINDOW_H
